﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
using VOL;

namespace Web.Admin
{
    public partial class NhaCungCapManager : System.Web.UI.Page
    {
        NhaCungCapBL _NhaCungCapBLL = new NhaCungCapBL();
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {
                FillData();
            }
        }

        private void FillData()
        {
            GridView1.DataSource = _NhaCungCapBLL.GetData();
            GridView1.DataBind();
        }

        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "cmdDelete")
            {
                int MaNhaCungCap = int.Parse(e.CommandArgument.ToString());
                _NhaCungCapBLL.deleteNhaCungCap(MaNhaCungCap);
                FillData();
            }
        }
    }
}